function [A] = Amatrix(x,mdl)
% this funtion creates the A matrix for different models, using the parameters in the vector (x)

if mdl == 1
    dm = [-x(3)-x(4)-x(5)-x(6); -x(3)-x(4)-2*x(5)]; dm = [dm; flip(dm)];
    d = [-5*x(1); -x(3)-x(5)-x(6); dm; -x(4)-x(5)-x(6); -5*x(2)];
    d1 = [x(1); x(6); x(6); x(5); x(5); x(5); x(4)+x(5)];
    d_1 = [x(3) + x(5); x(5); x(5); x(5); x(6); x(6); x(2)];
    A = eye(8,8) + diag(d) + diag(d1,1) + diag(d_1,-1);
    A(3:6,1) = x(3); A(3:6,8) = x(4); A(1,3:6) = x(1); A(8,3:6) = x(2);
end

end
